/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/


%module (docstring="Fulguro Morpho Module") flgrmorpho


%include ../common/common.i


%inline %{

#include <flgrCoreTypes.h>
#include <flgrCoreErrors.h>
#include <flgrCoreData.h>
#include <flgrCoreVector.h>
#include <flgrCoreNhbManage.h>
#include <flgrMorphoAmibes.h>
#include <flgrMorphoKerOp.h>
#include <flgrMorphoBase.h>
#include <flgrMorphoBaseLog.h>
#include <flgrMorphoBaseSegment.h>
#include <flgrMorphoGeodesy.h>
#include <flgrMorphoGeodesyFast.h>
#include <flgrMorphoLabel.h>
#include <flgrMorphoDistance.h>
#include <flgrMorphoWatershed.h>
#include <flgrMorphoSkiz.h>
#include <flgrMorphoGolay.h>

%}

%callback("CB_%(upper)s");

/*********************************************************
 *********************************************************
 *********************************************************
 *** WARNING FLGR_VECTOR TYPEMAP FORBIDDEN HERE
 *********************************************************
 *********************************************************
 *********************************************************/
%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox1D Extracted neighborhood of a pixel
[return] nothing\n
Compute minimum of the extracted neighborhood
""") flgr1d_get_nhb_minimum;
void flgr1d_get_nhb_minimum(FLGR_Vector *result, FLGR_NhbBox1D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox1D Extracted neighborhood of a pixel
[return] nothing\n
Compute maximum of the extracted neighborhood
""") flgr1d_get_nhb_maximum;
void flgr1d_get_nhb_maximum(FLGR_Vector *result, FLGR_NhbBox1D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox1D Extracted neighborhood of a pixel
[return] nothing\n
Compute median of the extracted neighborhood
""") flgr1d_get_nhb_median;
void flgr1d_get_nhb_median(FLGR_Vector *result, FLGR_NhbBox1D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox1D Extracted neighborhood of a pixel
[return] nothing\n
Compute hit or miss on the extracted neighborhood
""") flgr1d_get_nhb_hit_or_miss;
void flgr1d_get_nhb_hit_or_miss(FLGR_Vector *result, FLGR_NhbBox1D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox1D Extracted neighborhood of a pixel
[return] nothing\n
Compute thinning on the extracted neighborhood
""") flgr1d_get_nhb_thinning;
void flgr1d_get_nhb_thinning(FLGR_Vector *result, FLGR_NhbBox1D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox1D Extracted neighborhood of a pixel
[return] nothing\n
Compute thickening on the extracted neighborhood
""") flgr1d_get_nhb_thickening;
void flgr1d_get_nhb_thickening(FLGR_Vector *result, FLGR_NhbBox1D *extr);





%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox2D Extracted neighborhood of a pixel
[return] nothing\n
Compute minimum of the extracted neighborhood
""") flgr2d_get_nhb_minimum;
void flgr2d_get_nhb_minimum(FLGR_Vector *result, FLGR_NhbBox2D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox2D Extracted neighborhood of a pixel
[return] nothing\n
Compute maximum of the extracted neighborhood
""") flgr2d_get_nhb_maximum;
void flgr2d_get_nhb_maximum(FLGR_Vector *result, FLGR_NhbBox2D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox2D Extracted neighborhood of a pixel
[return] nothing\n
Compute median of the extracted neighborhood
""") flgr2d_get_nhb_median;
void flgr2d_get_nhb_median(FLGR_Vector *result, FLGR_NhbBox2D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox2D Extracted neighborhood of a pixel
[return] nothing\n
Compute hit or miss on the extracted neighborhood
""") flgr2d_get_nhb_hit_or_miss;
void flgr2d_get_nhb_hit_or_miss(FLGR_Vector *result, FLGR_NhbBox2D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox2D Extracted neighborhood of a pixel
[return] nothing\n
Compute thinning on the extracted neighborhood
""") flgr2d_get_nhb_thinning;
void flgr2d_get_nhb_thinning(FLGR_Vector *result, FLGR_NhbBox2D *extr);

%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox2D Extracted neighborhood of a pixel
[return] nothing\n
Compute thickening on the extracted neighborhood
""") flgr2d_get_nhb_thickening;
void flgr2d_get_nhb_thickening(FLGR_Vector *result, FLGR_NhbBox2D *extr);


%feature("autodoc","""
[out] FLGR_Vector result
[in] FLGR_NhbBox2D Extracted neighborhood of a pixel
[return] nothing\n
Dilate and preserve skiz
""") flgr2d_get_nhb_max_keep_skiz;
void flgr2d_get_nhb_max_keep_skiz(FLGR_Vector *result, FLGR_NhbBox2D *extr);


/*********************************************************
 *********************************************************
 *********************************************************
 *********************************************************/


%include ../common/typemap_flgr_vector.i


/*************************************************************
 *************************************************************
 *************************************************************
 *********************** 1D Functions ************************
 *************************************************************
 *************************************************************
 *************************************************************/

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Minkowski Addition of an image and a shape defined as a structuring element.
""") flgr1d_minkowski_add;
FLGR_Ret flgr1d_minkowski_add(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);


%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Minkowski Substraction of an image and a shape defined as a structuring element.
""") flgr1d_minkowski_sub;
FLGR_Ret flgr1d_minkowski_sub(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Erode an image using user define structuring element.
""") flgr1d_erode;
FLGR_Ret flgr1d_erode(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Dilate an image using user define structuring element.
""") flgr1d_dilate;
FLGR_Ret flgr1d_dilate(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Median Filter using user define structuring element.
""") flgr1d_median;
FLGR_Ret flgr1d_median(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Inner Gradient of an image using user define structuring element.
""") flgr1d_gradient_inner;
FLGR_Ret flgr1d_gradient_inner(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Outer Gradient of an image using user define structuring element.
""") flgr1d_gradient_outer;
FLGR_Ret flgr1d_gradient_outer(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Thick Gradient of an image using user define structuring element.
""") flgr1d_gradient_thick;
FLGR_Ret flgr1d_gradient_thick(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Open an image using user define structuring element.
""") flgr1d_open;
FLGR_Ret flgr1d_open(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Close an image using user define structuring element.
""") flgr1d_close;
FLGR_Ret flgr1d_close(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute an Open Tophat on an image using user define structuring element.
""") flgr1d_open_tophat;
FLGR_Ret flgr1d_open_tophat(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute a Close Tophat on an image using user define structuring element.
""") flgr1d_close_tophat;
FLGR_Ret flgr1d_close_tophat(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *nhb);  

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Structuring element map
[in] FLGR_Shape Shape to use
[return] FLGR_RET_OK,...\n
Erode an image using an adaptive structuring element.
For more information look flgr1d_raster_slide_structuring_function in core module

http://cmm.ensmp.fr/~lerallut/publis/lerallut_ismm05_presentation.pdf
http://cmm.ensmp.fr/~lerallut/publis/lerallut_ivc2006.pdf

""") flgr1d_erode_resizeable;
FLGR_Ret flgr1d_erode_resizeable(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *semap, FLGR_Shape shape);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Structuring element map
[in] FLGR_Shape Shape to use
[return] FLGR_RET_OK,...\n
Dilate an image using an adaptive structuring element.
For more information look flgr1d_raster_slide_structuring_function in core module

http://cmm.ensmp.fr/~lerallut/publis/lerallut_ismm05_presentation.pdf
http://cmm.ensmp.fr/~lerallut/publis/lerallut_ivc2006.pdf

""") flgr1d_dilate_resizeable;
FLGR_Ret flgr1d_dilate_resizeable(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *semap, FLGR_Shape shape);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] FLGR_Data1D Structuring element map
[in] FLGR_Shape Shape to use
[return] FLGR_RET_OK,...\n
Compute Median using an adaptive structuring element.
For more information look flgr1d_raster_slide_structuring_function in core module

http://cmm.ensmp.fr/~lerallut/publis/lerallut_ismm05_presentation.pdf
http://cmm.ensmp.fr/~lerallut/publis/lerallut_ivc2006.pdf

""") flgr1d_median_resizeable;
FLGR_Ret flgr1d_median_resizeable(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, FLGR_Data1D *semap, FLGR_Shape shape);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Dilate an image using Segment
""") flgr1d_dilate_line;
FLGR_Ret flgr1d_dilate_line(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, int sesize_x);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Erode an image using Segment
""") flgr1d_erode_line;
FLGR_Ret flgr1d_erode_line(FLGR_Data1D *datdest, FLGR_Data1D *datsrc, int sesize_x);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Erode an image using Horizontal Segment
Use logarithmic decomposition

R. van den Boomgaard and D.A. Wester, Logarithmic shape decomposition,
in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.
""") flgr1d_erode_log;
FLGR_Ret flgr1d_erode_log(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size);


%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Dilate an image using Horizontal Segment
Use logarithmic decomposition

R. van den Boomgaard and D.A. Wester, Logarithmic shape decomposition,
in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.
""") flgr1d_dilate_log;
FLGR_Ret flgr1d_dilate_log(FLGR_Data1D *lineout, FLGR_Data1D *linein, int size);



%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Open an image using Segment
""") flgr1d_open_line;
FLGR_Ret flgr1d_open_line(FLGR_Data1D *imgdest, FLGR_Data1D *imgsrc, int sesize_x);

%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Close an image using  egment
""") flgr1d_close_line;
FLGR_Ret flgr1d_close_line(FLGR_Data1D *imgdest, FLGR_Data1D *imgsrc, int sesize_x);
    
%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Compute Open Tophat using Segment
""") flgr1d_open_tophat_line;

FLGR_Ret flgr1d_open_tophat_line(FLGR_Data1D *imgdest, FLGR_Data1D *imgsrc, int sesize_x);
%feature("autodoc","""
[out] FLGR_Data1D signal Destination
[in] FLGR_Data1D signal Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Compute close Tophat using Segment
""") flgr1d_close_tophat_line;
FLGR_Ret flgr1d_close_tophat_line(FLGR_Data1D *imgdest, FLGR_Data1D *imgsrc, int sesize_x);
    

/*************************************************************
 *************************************************************
 *************************************************************
 *********************** 2D Functions ************************
 *************************************************************
 *************************************************************
 *************************************************************/

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Minkowski Addition of an image and a shape defined as a structuring element.
""") flgr2d_minkowski_add;
FLGR_Ret flgr2d_minkowski_add(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Minkowski Substraction of an image and a shape defined as a structuring element.
""") flgr2d_minkowski_sub;
FLGR_Ret flgr2d_minkowski_sub(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Erode an image using user define structuring element.
""") flgr2d_erode;
FLGR_Ret flgr2d_erode(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Dilate an image using user define structuring element.
""") flgr2d_dilate;
FLGR_Ret flgr2d_dilate(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Median Filter using user define structuring element.
""") flgr2d_median;
FLGR_Ret flgr2d_median(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Inner Gradient of an image using user define structuring element.
""") flgr2d_gradient_inner;
FLGR_Ret flgr2d_gradient_inner(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Outer Gradient of an image using user define structuring element.
""") flgr2d_gradient_outer;
FLGR_Ret flgr2d_gradient_outer(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute Thick Gradient of an image using user define structuring element.
""") flgr2d_gradient_thick;
FLGR_Ret flgr2d_gradient_thick(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Open an image using user define structuring element.
""") flgr2d_open;
FLGR_Ret flgr2d_open(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Close an image using user define structuring element.
""") flgr2d_close;
FLGR_Ret flgr2d_close(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute an Open Tophat on an image using user define structuring element.
""") flgr2d_open_tophat;
FLGR_Ret flgr2d_open_tophat(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood declaration
[return] FLGR_RET_OK,...\n
Compute a Close Tophat on an image using user define structuring element.
""") flgr2d_close_tophat;
FLGR_Ret flgr2d_close_tophat(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);  

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Structuring element map
[in] FLGR_Shape Shape to use
[return] FLGR_RET_OK,...\n
Erode an image using an adaptive structuring element.
For more information look flgr2d_raster_slide_structuring_function in core module

http://cmm.ensmp.fr/~lerallut/publis/lerallut_ismm05_presentation.pdf
http://cmm.ensmp.fr/~lerallut/publis/lerallut_ivc2006.pdf

""") flgr2d_erode_resizeable;
FLGR_Ret flgr2d_erode_resizeable(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *semap, FLGR_Shape shape);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Structuring element map
[in] FLGR_Shape Shape to use
[return] FLGR_RET_OK,...\n
Dilate an image using an adaptive structuring element.
For more information look flgr2d_raster_slide_structuring_function in core module

http://cmm.ensmp.fr/~lerallut/publis/lerallut_ismm05_presentation.pdf
http://cmm.ensmp.fr/~lerallut/publis/lerallut_ivc2006.pdf

""") flgr2d_dilate_resizeable;
FLGR_Ret flgr2d_dilate_resizeable(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *semap, FLGR_Shape shape);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Structuring element map
[in] FLGR_Shape Shape to use
[return] FLGR_RET_OK,...\n
Compute Median using an adaptive structuring element.
For more information look flgr2d_raster_slide_structuring_function in core module

http://cmm.ensmp.fr/~lerallut/publis/lerallut_ismm05_presentation.pdf
http://cmm.ensmp.fr/~lerallut/publis/lerallut_ivc2006.pdf

""") flgr2d_median_resizeable;
FLGR_Ret flgr2d_median_resizeable(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *semap, FLGR_Shape shape);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Dilate an image using Horizontal Segment
""") flgr2d_dilate_line_horizontal;
FLGR_Ret flgr2d_dilate_line_horizontal(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int sesize_x);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Erode an image using Horizontal Segment
""") flgr2d_erode_line_horizontal;
FLGR_Ret flgr2d_erode_line_horizontal(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int sesize_x);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Erode an image using Horizontal Segment.
Use logarithmic decomposition

R. van den Boomgaard and D.A. Wester, Logarithmic shape decomposition,
in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.
""") flgr2d_erode_line_horizontal;
FLGR_Ret flgr2d_erode_line_horizontal_log(FLGR_Data2D *lineout, FLGR_Data2D *linein, int size);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Dilate an image using Horizontal Segment
Use logarithmic decomposition

R. van den Boomgaard and D.A. Wester, Logarithmic shape decomposition,
in Aspects of Visual Form Processing, C. Arcelli, L.P. Cordella, and G. Sanniti di Baja (Eds.),
World Scientific Publishing Co.: Singapore, Capri, Italy, 1994, pp. 552-561.""") flgr2d_dilate_line_horizontal;
FLGR_Ret flgr2d_dilate_line_horizontal_log(FLGR_Data2D *lineout, FLGR_Data2D *linein, int size);



%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[in] Integer se height
[return] FLGR_RET_OK,...\n
Dilate an image using Rectangle
""") flgr2d_dilate_rectangle;
FLGR_Ret flgr2d_dilate_rectangle(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int sesize_x, int sesize_y);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[in] Integer se height
[return] FLGR_RET_OK,...\n
Erode an image using Rectangle
""") flgr2d_erode_rectangle;
FLGR_Ret flgr2d_erode_rectangle(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int sesize_x, int sesize_y);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Open an image using Horizontal Segment
""") flgr2d_open_line_horizontal;
FLGR_Ret flgr2d_open_line_horizontal(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Close an image using Horizontal Segment
""") flgr2d_close_line_horizontal;
FLGR_Ret flgr2d_close_line_horizontal(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x);
    
%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[in] Integer se height
[return] FLGR_RET_OK,...\n
Open an image using Rectangle
""") flgr2d_open_rectangle;
FLGR_Ret flgr2d_open_rectangle(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x, int sesize_y);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[in] Integer se height
[return] FLGR_RET_OK,...\n
Close an image using Rectangle
""") flgr2d_close_rectangle;
FLGR_Ret flgr2d_close_rectangle(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x, int sesize_y);
    
%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Compute Open Tophat using Horizontal Segment
""") flgr2d_open_tophat_line_horizontal;

FLGR_Ret flgr2d_open_tophat_line_horizontal(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x);
%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[return] FLGR_RET_OK,...\n
Compute close Tophat using Horizontal Segment
""") flgr2d_close_tophat_line_horizontal;
FLGR_Ret flgr2d_close_tophat_line_horizontal(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x);
    
%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[in] Integer se height
[return] FLGR_RET_OK,...\n
Compute Open Tophat using Rectangle
""") flgr2d_open_tophat_rectangle;
FLGR_Ret flgr2d_open_tophat_rectangle(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x, int sesize_y);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Integer se width
[in] Integer se height
[return] FLGR_RET_OK,...\n
Compute Close Tophat using Rectangle
""") flgr2d_close_tophat_rectangle;
FLGR_Ret flgr2d_close_tophat_rectangle(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, int sesize_x, int sesize_y);
  


%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood definition
[return] FLGR_RET_OK,...\n
Dilate label image and avoid label overlap
""") flgr2d_dilate_preserving_skiz;
FLGR_Ret flgr2d_dilate_preserving_skiz(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, FLGR_Data2D *nhb);










%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Compute a Close Tophat on an image using user define structuring element.
""") flgr2d_label;
FLGR_Ret flgr2d_label(FLGR_Data2D *imglabel, FLGR_Data2D *imgsrc, FLGR_Connexity connexity);

%feature("autodoc","""
[inout] FLGR_Data2D Image Marker
[in] FLGR_Data2D Image Mask
[out] volume vector 
[return] FLGR_RET_OK,...\n
Geodesic dilate in 8-connexity Marker regarding the Mask
""") flgr2d_geodesic_dilate_8_connexity;
FLGR_Ret flgr2d_geodesic_dilate_8_connexity(FLGR_Data2D *, FLGR_Data2D *);

%feature("autodoc","""
[inout] FLGR_Data2D Image Marker
[in] FLGR_Data2D Image Mask
[out] volume vector 
[return] FLGR_RET_OK,...\n
Geodesic dilate in 8-connexity Marker regarding the Mask
""") flgr2d_geodesic_erode_8_connexity;
FLGR_Ret flgr2d_geodesic_erode_8_connexity(FLGR_Data2D *, FLGR_Data2D *);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Marker
[in] FLGR_Data2D Image Mask
[in] FLGR_Data2D Neighborhood definition
[return] FLGR_RET_OK,...\n
Geodesic erode Marker regarding the Mask
""") flgr2d_geodesic_erode;
FLGR_Ret flgr2d_geodesic_erode(FLGR_Data2D *, FLGR_Data2D *, FLGR_Data2D *, FLGR_Data2D *);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Marker
[in] FLGR_Data2D Image Mask
[in] FLGR_Data2D Neighborhood definition
[return] FLGR_RET_OK,...\n
Geodesic dilate Marker regarding the Mask
""") flgr2d_geodesic_dilate;
FLGR_Ret flgr2d_geodesic_dilate(FLGR_Data2D *, FLGR_Data2D *, FLGR_Data2D *, FLGR_Data2D *);

%feature("autodoc","""
[inout] FLGR_Data2D Image Marker
[in] FLGR_Data2D Image Mask
[in] FLGR_Data2D Neighborhood definition
[return] FLGR_RET_OK,...\n
Geodesic reconstruction by dilating or eroding Marker regarding the Mask.
This filter is self-dual.
""") flgr2d_geodesic_reconstruct_dual;
FLGR_Ret flgr2d_geodesic_reconstruct_dual(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity);


%feature("autodoc","""
[inout] FLGR_Data2D Image Marker
[in] FLGR_Data2D Image Mask
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Geodesic Reconstruct by dilating Marker regarding the Mask until stability
""") flgr2d_geodesic_reconstruct_dilate;
FLGR_Ret flgr2d_geodesic_reconstruct_dilate(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity);

%feature("autodoc","""
[inout] FLGR_Data2D Image Marker
[in] FLGR_Data2D Image Mask
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Geodesic Reconstruct by eroding Marker regarding the Mask until stability
""") flgr2d_geodesic_reconstruct_erode;
FLGR_Ret flgr2d_geodesic_reconstruct_erode(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Reconstruct by openning
""") flgr2d_geodesic_reconstruct_open;
FLGR_Ret flgr2d_geodesic_reconstruct_open(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Reconstruct by closing
""") flgr2d_geodesic_reconstruct_close;
FLGR_Ret flgr2d_geodesic_reconstruct_close(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Close Tophat by reconstruction
""") flgr2d_geodesic_reconstruct_open_tophat;
FLGR_Ret flgr2d_geodesic_reconstruct_open_tophat(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Open Tophat by reconstruction
""") flgr2d_geodesic_reconstruct_close_tophat;
FLGR_Ret flgr2d_geodesic_reconstruct_close_tophat(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);



%feature("autodoc","""
[inout] FLGR_Data2D Image  Source/Destination
[in] FLGR_Data2D Image Mask
[return] FLGR_RET_OK,...\n
Geodesic Dilation 8-connex
""") flgr2d_geodesic_dilate_8_connexity;
 FLGR_Ret flgr2d_geodesic_dilate_8_connexity(FLGR_Data2D *datmark, FLGR_Data2D *datmask);

%feature("autodoc","""
[inout] FLGR_Data2D Image  Source/Destination
[in] FLGR_Data2D Image Mask
[return] FLGR_RET_OK,...\n
Geodesic Erosion 8-connex
""") flgr2d_geodesic_erode_8_connexity;
FLGR_Ret flgr2d_geodesic_erode_8_connexity(FLGR_Data2D *datmark, FLGR_Data2D *datmask);

%feature("autodoc","""
[inout] FLGR_Data2D Image  Source/Destination
[in] FLGR_Data2D Image Mask
[in] Connexity (FLGR_4_CONNEX, ...)
[return] FLGR_RET_OK,...\n
Geodesic Reconstruction by dilation using simple parallel definition (dilate + inf, dilate + inf, ...)
""") flgr2d_geodesic_reconstruct_dilate_parallel;
FLGR_Ret flgr2d_geodesic_reconstruct_dilate_parallel(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity);


%feature("autodoc","""
[inout] FLGR_Data2D Image  Source/Destination
[in] FLGR_Data2D Image Mask
[in] Connexity (FLGR_4_CONNEX, ...)
[return] FLGR_RET_OK,...\n
Geodesic Reconstruction by erosion using simple parallel definition (erode + sup, erode + sup, ...)
""")flgr2d_geodesic_reconstruct_erode_parallel;
 FLGR_Ret flgr2d_geodesic_reconstruct_erode_parallel(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Reconstruct by openning (parallel version)
""") flgr2d_geodesic_reconstruct_open_parallel;
FLGR_Ret flgr2d_geodesic_reconstruct_open_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Reconstruct by closing (parallel version)
""") flgr2d_geodesic_reconstruct_close_parallel;
FLGR_Ret flgr2d_geodesic_reconstruct_close_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Close Tophat by reconstruction (parallel version)
""") flgr2d_geodesic_reconstruct_open_tophat_parallel;
FLGR_Ret flgr2d_geodesic_reconstruct_open_tophat_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] FLGR_Data2D Neighborhood Definition
[return] FLGR_RET_OK,...\n
Geodesic Open Tophat by reconstruction (parallel version)
""") flgr2d_geodesic_reconstruct_close_tophat_parallel;
FLGR_Ret flgr2d_geodesic_reconstruct_close_tophat_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb);


%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Vector, List or Scalar for Minima Level
[in] String for connexity
[return] FLGR_RET_OK,...\n
nd regional H-minima
""") flgr2d_regional_hminima;
FLGR_Ret flgr2d_regional_hminima(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Scalar for Maxima Level
[in] String for connexity
[return] FLGR_RET_OK,...\n
find regional H-maxima
""") flgr2d_regional_hmaxima;
FLGR_Ret flgr2d_regional_hmaxima(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity);


%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Vector, List or Scalar for Minima Level
[in] String for connexity
[return] FLGR_RET_OK,...\n
find regional H-minima (parallel version)
""") flgr2d_regional_hminima_parallel;
FLGR_Ret flgr2d_regional_hminima_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] Scalar for Maxima Level
[in] String for connexity
[return] FLGR_RET_OK,...\n
find regional H-maxima (parallel version)
""") flgr2d_regional_hmaxima_parallel;
FLGR_Ret flgr2d_regional_hmaxima_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity);

%feature("autodoc","""
[out] FLGR_Data2D Image Destination
[in] FLGR_Data2D Image Source
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Compute the morphological distance on a binary images (image values must be 0 or 255).
""") flgr2d_distance;
FLGR_Ret flgr2d_distance(FLGR_Data2D  *imgdest, FLGR_Data2D  *imgsrc, FLGR_Connexity connexity);

%feature("autodoc","""
[inout] FLGR_Data2D Image Label
[in] FLGR_Data2D Image Source
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Compute the basic watershed by immersion. This version is biased.
""") flgr2d_watershed;
FLGR_Ret flgr2d_watershed(FLGR_Data2D  *imlabel, FLGR_Data2D  *imsrc, FLGR_Connexity connexity);

%feature("autodoc","""
[out] FLGR_Data2D Image destination
[in] FLGR_Data2D Image Label
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Construct the watershed line using the label image from the watershed
""") flgr2d_watershed_build_line;
FLGR_Ret flgr2d_watershed_build_line(FLGR_Data2D *imdest, FLGR_Data2D *imlabel, FLGR_Connexity connexity);


%feature("autodoc","""
[inout] FLGR_Data2D region Labelized
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Compute the skiz on binary images by dilating labelized componnents.
""") flgr2d_skiz;
FLGR_Ret flgr2d_skiz(FLGR_Data2D *labelizeImage, FLGR_Connexity connexity);

%feature("autodoc","""
[inout] FLGR_Data2D region Labelized
[in] FLGR_Data2D mask
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Compute the skiz on binary images by dilating labelized componnents.
""") flgr2d_skiz;
FLGR_Ret flgr2d_geodesic_skiz(FLGR_Data2D *labelizeImage, FLGR_Data2D *datmask, FLGR_Connexity connexity);


%feature("autodoc","""
[inout] FLGR_Data2D (take labelized minima and give region Labelized)
[in] FLGR_Data2D image source
[in] 8-connexity or 6-connexity or 4-connexity
[return] FLGR_RET_OK,...\n
Compute watershed by geodesic skiz
""") flgr2d_skiz;
FLGR_Ret flgr2d_watershed_by_skiz(FLGR_Data2D *labelizedMinima, FLGR_Data2D *datsrc, FLGR_Connexity connexity);



typedef struct{
  %immutable;
  FLGR_Data2D **se;
  int nbse;
  %mutable;
}FLGR_Golay;



FLGR_Golay* flgr2d_create_golay(char *letter, FLGR_Type type, FLGR_Connexity connexity);

void flgr2d_destroy_golay(FLGR_Golay* gl);
  



%nocallback;

